package com.gzx.plugin.tjzy.modular.call.single.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gzx.plugin.tjzy.modular.call.single.entity.vo.GzxSinglePointCallsVo;
import com.gzx.plugin.tjzy.modular.call.single.service.GzxSinglePointService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.common.annotation.CommonNoRepeat;
import vip.xiaonuo.common.page.PageQuery;
import vip.xiaonuo.common.pojo.CommonResult;


/**
 * 单点呼叫信息表 控制层
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/tjzy/singleCall")
public class GzxSinglePointCallController {
    private final GzxSinglePointService baseService;

    /**
     * 查询呼叫记录
     *
     * @param pageQuery。分页条件
     * @return 返回分页数据
     */
    @PostMapping("/page")
    public CommonResult<Page<GzxSinglePointCallsVo>> pageList(@RequestBody PageQuery pageQuery) {
        return CommonResult.data(baseService.pageList(pageQuery));
    }

    /**
     * 插入呼叫记录
     *
     * @param callNum 电话号码
     * @return 返回是否成功
     */
    @PostMapping("/add/{callNum}")
    @CommonNoRepeat
    public CommonResult<Void> insertData(@PathVariable String callNum) {
        baseService.insertData(callNum);
        return CommonResult.ok();
    }


}